package com.wing.wcabinet.model.response;

import com.wing.cabinet.utils.ExcelExport;
import com.wing.product.model.entity.ProductType;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.baomidou.mybatisplus.annotation.TableField;
import com.wing.wcabinet.model.entity.WcabCellInventoryInout;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 售刀柜上货(上货主表无展示)/领取VO
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
public class WcabCellInventoryInoutVO {

    /**
     * ID
     */
    private Long id;

    /**
     * 创建时间
     */
    @JsonFormat(timezone = "GMT+8" , pattern = "yyyy-MM-dd HH:mm:ss" )
    private LocalDateTime createTime;

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 存刀任务编号
     */
    private String code;

    /**
     * 配送单id
     */
    private Long deliveryId;

    /**
     * 操作类型
     */
    private WcabCellInventoryInout.InoutType inoutType;

    /**
    * 操作类型描述
    */
    @TableField(exist = false)
    private String inoutTypeDesc;

    public String getInoutTypeDesc() {
        if (this.inoutType!=null){
            return inoutType.getDesc();
        }
        return null;
    }

    /**
     * no
     */
    private Integer no;

    /**
     * day
     */
    private Integer day;

    /**
     * 设备台机
     */
    private String deviceCode;

    /**
     * 是否已同步：no(0,未同步);yes(1,已同步);
     */
    private Integer isSyns;

    /**
     * 同步时间
     */
    @JsonFormat(timezone = "GMT+8" , pattern = "yyyy-MM-dd HH:mm:ss" )
    private LocalDateTime synsTime;

    /**
     * 是否已形成账单
     */
    private WcabCellInventoryInout.IsBill isBill;

    /**
    * 是否已形成账单描述
    */
    @TableField(exist = false)
    private String isBillDesc;

    public String getIsBillDesc() {
        if(this.isBill!=null){
            return isBill.getDesc();
        }
        return null;
    }

    /**
     * 上货记录id
     */
    private Long receiveLoadId;

    /**
     * enterpriseId
     */
    private Long enterpriseId;

    /**
     * 工序id
     */
    private Long processId;

    /**
     * 计划id
     */
    private Long planId;

    /**
     * enterpriseCode
     */
    private String enterpriseCode;

    /**
     * 业务类型
     */
    private WcabCellInventoryInout.BusinessType businessType;

    /**
    * 业务类型描述
    */
    @TableField(exist = false)
    private String businessTypeDesc;

    public String getBusinessTypeDesc() {
        if(this.businessType!=null){
            return businessType.getDesc();
        }
        return null;
    }

    private WcabCellInventoryInout.OperationType operationType;

    private String operationTypeDesc;

    public String getOperationTypeDesc(){
        if (this.operationType!=null){
            return operationType.getDesc();
        }
        return "";
    }



    //

    /**
     * 上货/领取id
     */
    private Long inoutId;

    /**
     * 柜子id
     */
    private Long cabId;

    /**
     * sku id
     */
    private Long skuId;

    /**
     * 数量
     */
    @ExcelExport(value = "产品数量",sort = 6)
    private Integer quantity;

    /**
     * 企业id
     */
    private Long companyId;

    /**
     * 公司名称
     */
    private String companyName;

    /**
     * 货道id
     */
    private Long spaceId;


    /**
     * sku code
     */
    @ExcelExport(value = "物料编号",sort = 5)
    private String skuCode;

    /**
     * 柜子编码
     */
    @ExcelExport(value = "柜子编号",sort = 2)
    private String cabCode;


    /**
     * 货道
     */
    @ExcelExport(value = "货位编号",sort = 3)
    private String spaceCode;

    /**
     * 当前库存
     */
    private Integer quantityCurrent;

    /**
     * 变动后库存
     */
    private Integer quantityAfter;

    /**
     * 产品SKU名称
     */
    @ExcelExport(value = "物料名称",sort = 4)
    private String skuName;

    /**
     * 产品规格
     */
    private String skuSpec;








    /**
     * sku 图片
     */
    private String skuPic;

    /**
     * 产品名称
     */
    private String productName;

    /**
     * 产品类型名称
     */
    private String productTypeName;

    /**
     * 产品分类名称
     */
    private String productCategoryName;

    /**
     * 产品品牌
     */
    private String productBrandName;

    /**
     * 产品型号
     */
    private String productModelName;

    /**
     * 适配机床
     */
    private String deviceName;

    /**
     * 市场价
     */
    @ExcelExport(value = "单价(市场)",sort = 10)
    private BigDecimal marketPrice;

    private Integer quantityMax;

    /**
     * 单位
     */
    private String unitName;


    /**
     * 领用订单内所有产品的总价值
     */
    @TableField(exist = false)
    private BigDecimal money;


    private String orderCode;
    /**
     * 备注
     */
    private String remark;

    private String skuSpecOld;



    private Long inoutDetailId;


    private Long quantityRemaining;

    private Long quantityAlarm;

    private Long quantitySuggest;


    private BigDecimal weight;

    private Long allocationId;



    /**
     * 状态
     */
    private WcabCellInventoryInout.Status status;

    /**
     * 状态描述
     */
    @TableField(exist = false)
    private String statusDesc;

    public String getStatusDesc() {
        return status == null ? null : status.getDesc();
    }

    /**
     * 盘验时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime checkTime;

    /**
     * 盘验人id
     */
    private Long checkUserId;

    /**
     * 盘验人
     */
    private String checkUserName;

    /**
     * 通知时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime notifyTime;

    /**
     * 通知人
     */
    private Long notifyUserId;

    /**
     * 通知人
     */
    private String notifyUserName;

    /**
     * 回收人id
     */
    private Long takeUserId;

    /**
     * 回收人
     */
    private String takeUserName;

    /**
     * 回收时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime takeTime;

    /**
     * 盘验完操作类型
     */
    private Integer operationTypeChecked;

    /**
     * 盘验完业务类型
     */
    private WcabCellInventoryInout.BusinessTypeChecked businessTypeChecked;

    /**
     * 签收人id
     */
    private String signUserId;

    /**
     * 签收时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime signTime;

    /**
     * 签收人
     */
    private String signUserName;

    /**
     * 盘验结果id
     */
    private Long checkedResultId;

    /**
     * 通知供应商id
     */
    private Long supplierId;

    /**
     * 通知供应商
     */
    private String supplierName;

    /**
     * 盘验：0：否，1：是
     */
    private Boolean isCheck;

    /**
     * supplierCompanyId
     */
    private Long supplierCompanyId;

    /**
     * 姓名
     */
    private String creatorNickname;


    /**
     * businessTypePre
     */
    private WcabCellInventoryInout.BusinessTypePre businessTypePre;

    /**
     * useInventoryInoutId
     */
    private Long useInventoryInoutId;

    /**
     * checkInventoryInoutId
     */
    private Long checkInventoryInoutId;

    /**
     * storageInventoryOutId
     */
    private Long storageInventoryOutId;

    /**
     * workOrderId
     */
    private Long workOrderId;

    /**
     * departmentId
     */
    private Long departmentId;

    /**
     * departmentName
     */
    private String departmentName;


    private ProductType.WeightUnit weightUnit;

    private String weightUnitDesc;

    public String getWeightUnitDesc(){
        if (this.weightUnit!=null){
            return this.weightUnit.getDesc();
        }
        return "";
    }

    private String quantityUnitDesc;

    private String oldSpecCode;


}
